package com.java.runnable.exer2;

/**
 * @author shkstart
 * @create 2021-01-28 11:00
 */
public class MainTest {
    public static void main(String[] args) {
        Test_1 test_1 = new Test_1();
        Thread thread = new Thread(test_1);
        thread.start();
        while (thread.isAlive()) {
            try {
                Thread.sleep(5);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        double x = 1.0;
        double sum = 0.0;
        for (int i = 0; i < 1000; i++) {
            sum += 1 / (add(x + i));
            System.out.println(sum);
        }

    }

    public static double add(double x) {
        if (x == 0) {
            return 1;
        } else {
            return x * add(x - 1);
        }
    }

}
